package com.bvr;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Vector;

import org.json.JSONException;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.AndroidHttpTransport;
import org.xmlpull.v1.XmlPullParserException;

import android.app.Activity;
import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class BidActivty extends ListActivity {
	/*UI Controls Start*/
	private ImageView imgBidDetail;
	
	private TextView lblbidDetailStatus;
	private TextView lblbidDetailRentalName;
	private TextView lblbidDetailDateOfRequest;
	private TextView lblbidDetailDurationDetails;
	private TextView lblbidDetailHouse;
	private TextView lblbidDetailOfferAmount;
	private TextView lblbidDetailStatusBottom;
	
	/*UI Controls Ends*/
	
	public static BidObject objBid;
	
	/*Web Service Variables Start*/
	private static  String URL = "";
	private static  String METHOD_NAME = "";
	private static  String NAMESPACE = "";
	private static  String SOAP_ACTION = "";
	/*Web Service Variables Ends*/
	
	private static String strPropertyId;
	private static int propertyId;
	private Runnable viewOrders;
	private ProgressDialog m_ProgressDialog = null;


	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.bid_detail);		
		
		System.out.println("Bed :" + objBid.getBed());
		System.out.println("Sleep :" + objBid.getSleep());
		System.out.println("Status :" + objBid.getStatus());		
		System.out.println("Bid Id :" + objBid.getID());
		setUI();
	}	
	
	private void setUI()
	{
		lblbidDetailStatus = (TextView) findViewById(R.id.bidDetailStatus);
		lblbidDetailStatus.setText(objBid.getStatus());
		
		lblbidDetailStatusBottom =(TextView) findViewById(R.id.bidDetailStatusBottom);
		lblbidDetailStatusBottom.setText("Status: "+objBid.getStatus());
		
		imgBidDetail = (ImageView)findViewById(R.id.imgBidDetail);
		
		if(objBid.getStatus().equalsIgnoreCase("pending"))
		{
			imgBidDetail.setImageResource(R.drawable.pending_icon);
			lblbidDetailStatus.setTextColor(R.color.BidPendingColor);
			lblbidDetailStatusBottom.setTextColor(R.color.BidPendingColor);
			
		}
		else if(objBid.getStatus().equalsIgnoreCase("confirmed"))
		{
			imgBidDetail.setImageResource(R.drawable.accept_icon);	
			lblbidDetailStatus.setTextColor(R.color.BidConfirmColor);
			lblbidDetailStatusBottom.setTextColor(R.color.BidConfirmColor);
			
		}
		else
		{
			imgBidDetail.setImageResource(R.drawable.pending_icon);	
			lblbidDetailStatus.setTextColor(R.color.BidCancelColor);
			lblbidDetailStatusBottom.setTextColor(R.color.BidCancelColor);
			
		}
		
		lblbidDetailRentalName= (TextView) findViewById(R.id.bidDetailRentalName);
		lblbidDetailRentalName.setText("Name: "+objBid.getRentalName());
		
		lblbidDetailDateOfRequest= (TextView) findViewById(R.id.bidDetailDateOfRequest);
		lblbidDetailDateOfRequest.setText("Date Of Request: "+objBid.getDateOfRequest());
		
		lblbidDetailDurationDetails= (TextView) findViewById(R.id.bidDetailDuration);
		lblbidDetailDurationDetails.setText("Duration Detail: "+objBid.getDurationDetails());
		
		lblbidDetailHouse= (TextView) findViewById(R.id.bidDetailHouse);
		String strBidHouse = "House: "+ objBid.getBed() + " Bedrooms, " + objBid.getSleep() +" Sleep";  
		lblbidDetailHouse.setText(strBidHouse);
		
		lblbidDetailOfferAmount= (TextView) findViewById(R.id.bidDetailRate);
		lblbidDetailOfferAmount.setText("$"+objBid.getOfferAmount());
		
	
	}
}
